var Message={
	SaveSuccess:'保存成功！',
	SaveFaild:'保存失败！',
	DeleteSuccess:'删除成功！',
	DeleteFaild:'删除失败'
};
         
      
var MessageType={'OK':1,'ERROR':2};

function setWordsLimit(textarea) {
	var maxlength = $(textarea).attr("maxlength");
	var val = $(textarea).val();
	var span = $(textarea).parent().parent().find(".tip span").get(0);
	$(span).html(parseInt(maxlength) - val.length);
}


function showMessage(msg,type){
	var sign="icon-ok-sign";
	switch(type){
		case MessageType.OK:
			sign="icon-ok-sign";
			$('#msgTip').removeAttr('class').addClass('alert alert-success');
			break;
		case MessageType.ERROR:
			sign="icon-ban-circle ";
			$('#msgTip').removeAttr('class').addClass('alert alert-danger');
			break;
		default:
			break;
	}
	$("#msgTip").html('<i class="'+sign+' icon-large"></i>'+msg);
	
	
	$("#msgTip").fadeIn("1000",function(){
		$("#msgTip").fadeOut(3000);
	})
}

function showLoading(msg,img){
	var html="<div id='_juqery_loading' class='loading_bkg'></div>";
	html+="<div id='_jquery_loading_box' class='loading_box'><img src='"+img+"'/><span>"+msg+"</span></div>";
	$(html).appendTo("body");
}
function hideLoading(){
	$("#_juqery_loading").remove();
	$("#_jquery_loading_box").remove();
}